define({
	title: 'home',
	body: `
	<div class='body'>
	<div class='topHeader'>
		<span class='top-pageLogo'>重庆市农业气象精细化智能服务平台</span>
		<span class='top-pageName'>运行监控子系统</span>
		<div class='top-homebar'>
			<span class='nav-home'>首页</span>
			<span class='nav-map'>地图</span>
			<label>当前区域：
				<span id="addr-show02">重庆</span>
			</label>
			<div class='log-btn-group'>
				<a herf='#' class='log-btn'>登录</a>
				<a herf='#' class='log-btn'>注册</a>
			</div>
		</div>
	</div>
	<div class='bodyContent wrapper'>
		<div class='chart1'>
			<div class='chartHeader'>产品总数</div>
			<div class='boxBorder'>
				<div class='chartContent chartContent1'></div>
			</div>
		</div>
		<div class='chart2'>
			<div class='chartHeader'>注册农田</div>
			<div class='boxBorder'>
				<div class='chartContent chartContent2'></div>
			</div></div>
		<div class='chart3'>
			<div class='chartHeader'>专家活跃TOP10</div>
			<div class='boxBorder'>
				<div class='chartContent chartContent3'></div>
			</div></div>
		<div class='chart4'>
			<div class='chartHeader'>年度发布数量</div>
			<div class='radarContent'></div>
			<div class='boxBorder'>
			<div class='chartContent chartContent4'></div>
			</div></div>
		<div class='chart5'>
			<div class='chartHeader'>状态监控</div>
			<div class='boxBorder'>
				<div class='chartContent chartContent5'></div>
			</div></div>
		<div class='chart6'>
			<div class='chartHeader'>服务对象</div>
			<div class='boxBorder'>
				<div class='chartContent chartContent6'></div>
			</div></div>
		<div class='chart7'>
			<div class='chartHeader'>农情上传</div>
			<div class='boxBorder'>
				<div class='chartContent chartContent7'></div>
			</div></div>
		<div class='chart8'>
			<div class='chartHeader'>实景监控</div>
			<div class='boxBorder'>
				<div class='chartContent chartContent8'></div>
			</div></div>
		</div>
		
	</div>
	</div>
	`,
	init: function (pageData) {
		var $view = this;
		// 获取hash
		function getHash(url) {
			url = url || location.href
			return url.replace(/^[^#]*#?\/?(.*)\/?$/, '$1')
		}
		$view.on('click', '.nav-map', function (event) {
			event.preventDefault()
			$doc.trigger("spa:navigate", {
				hash: "pageOneMap"
			})
		})

		$view.on('click', '.nav-home', function (event) {
			event.preventDefault();
			$doc.trigger("spa:navigate", {
				hash: ""
			})
		})
	},
	afteropen: function () {
		//加载图表
		var config = [{
				chartName: 'chart1',
				domName: 'chartContent1'
			},
			{
				chartName: 'chart2',
				domName: 'chartContent2'
			},
			{
				chartName: 'chart3',
				domName: 'chartContent3'
			},
			{
				chartName: 'chart4',
				domName: 'chartContent4'
			},
			{
				chartName: 'chart5',
				domName: 'chartContent5'
			},
			{
				chartName: 'chart6',
				domName: 'chartContent6'
			},
			{
				chartName: 'chart7',
				domName: 'chartContent7'
			},
			{
				chartName: 'chart8',
				domName: 'chartContent8'
			},
		];
		config.forEach(x => {
			let myChart = null;

			if (x.chartName == 'chart4') {
				myChart = [echarts.init(document.getElementsByClassName(x.domName)[0], 'dark'), echarts.init(document.getElementsByClassName('radarContent')[0], 'dark')];
			} else if (x.chartName == 'chart8') {

			} else {
				myChart = echarts.init(document.getElementsByClassName(x.domName)[0], 'dark');
			}
			require([x.chartName], function ( chart ) {
				if (x.chartName == 'chart8'){
					chart.queryData()
				} else {
					chart.queryData(myChart)
				}

			})
		});
		$('#addr-show02').click(function(){
			/*自动加载省份列表*/
			require(['areajs'], function (area) {
				area.initAreaPanel();
			})
		})
	}
})